//
//  TypeClassData.m
//  YaoHeAPP
//
//  Created by mac on 15/12/15.
//  Copyright © 2015年 mac. All rights reserved.
//

#import "TypeClassData.h"

@implementation TypeClassData

-(id)initWithDic:(NSDictionary*)dict
{
    self=[super init];
    if (self)
    {
        self.text=[self withDic:dict Key:@"text"];
        self.value=[self withDic:dict Key:@"value"];
        self.spec=[self withDic:dict Key:@"spec"];
    }
    return self;
}

-(NSString*)withDic:(NSDictionary*)dic Key:(NSString*)key
{
    NSString*string;
    if ([[dic allKeys]containsObject:key]) {
        NSString*str=[NSString stringWithFormat:@"%@",dic[key]];
        if ([str rangeOfString:@"铝材"].location != NSNotFound) {
            string=[str stringByReplacingOccurrencesOfString:@"铝材" withString:@""];
        }
        else{
            string=str;
        }
    }
    else{
       string=@"";
    }
    return string;
}


@end
